<template>
  <simple-table 
  ref="tableTemplate"
  :showSearch="showSearch"
  :columns="pageData.columns" 
  :rowkey="pageData.pageConfig.rowKey" 
  :agilePageCode="currentPageCode"
  :queryParam="queryParam"
  :dictValues="pageData.dictValues"
  :subPages="pageData.subPages"
  :disableMixinCreated="true"
  ></simple-table>
</template>
<script>
  import {queryMaterialCategoryTreeList, agileTemplate} from '@/api/api'
  import { postAction } from '@/api/manage'
  import { getMpListShort } from "@/utils/util"
  import JDate from '@/components/jeecg/JDate'
  import SimpleTable from '@/components/table/SimpleTable'
  import Vue from 'vue'
  export default {
    name: "SimpleTablePage",
    components: {
      SimpleTable,
      JDate
    },
    props: {
      showSearch: {
        type: Boolean,
        required: false,
        default (){
          return true;
        }
      },
      agilePageCode: {
        type: String,
        required: false
      },
      queryParam: {
        type: Object,
        required: false,
        default (){
          return {};
        }
      }
    },
    data () {
      return {
        pageData: {
          pageConfig: {
            rowKey: "id"
          },
          // 表头
          columns: [
          ],
          
          dictValues: {},
          buttons:[]
        }
      }
    },
    computed: {
      currentPageCode(){        
        var that = this;
        if(!that.agilePageCode){
          const url = window.location.href;
          const agilePageCode = url.substr(url.lastIndexOf("/")+1);
          return agilePageCode;
        }
        return that.agilePageCode;
      }
    },
    created() {      
      var that = this;
      let pg = {}
      pg["agilePageCode"] = that.currentPageCode;
      agileTemplate.getPageConfig(pg).then(function (res) {
        if (res.ok) {
          that.pageData = Object.assign({}, that.pageData, res.data)
        }
      });
    },
    methods:{      
      reloadData(pageData){       
        return this.$refs.tableTemplate.reloadData(pageData)
      },
    },
    activated() {
      this.$refs.tableTemplate.reloadData()
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less'
</style>